﻿using Kingdee.BOS.JSON;
using Kingdee.BOS.ServiceFacade.KDServiceFx;
using Kingdee.BOS.WebApi.ServicesStub;
using System.Net.Http;

/// <summary>
/// 自定义webapi接口服务地址中比其他标准接口地址多了一个组件名，如果需要和其他其他标准接口保持一致，则二开自定义的webapi接口命名空间必须以.ServicesStub结尾
/// </summary>
namespace Kingdee.K3Erp.WebAPI.ServiceExtend.ServicesStub
{
    public class CustomBusinessService : AbstractWebApiBusinessService
    {
        public CustomBusinessService(KDServiceContext context)
            : base(context)
        { }

        public JSONArray ExecuteService(string parameter)
        {
            JSONArray jsonArray = new JSONArray();
            jsonArray.Add(parameter);
            return jsonArray;
        }

        public string HttpService()
        {
            var http = new HttpClient();
            var c = http.GetAsync("https://www.baidu.com").GetAwaiter().GetResult();
            var str = c.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            return str;
        }
    }
}

